package com.imooc.distributedemo.resume.leetcode;

public class SolutionDemo {
    public static void main(String[] args) {
        int n=5,i=2;
//        形成的环  0 1 2 3 4
//        对应关系   0-4 1-3 2-2
        int result = findOppoNumber(i,n);
        int ii = (-2+5)%5;
        int jj = (-1+5)%5;
        System.out.println(result);
    }

    public static int findOppoNumber(int n,int i){

        return (-i+n)%n;
    }
}
